/**
 * chrome 浏览器- js 运行器
 */

//var suffix = [".shtml",".html",".htm"];// 先后顺序
var suffix = ["shtml","html","htm"];// 先后顺序
//suffix = [".shtml"];// 先后顺序
//suffix = ".shtml";// 先后顺序
if(suffix.length == 1 || typeof(suffix) == "string"){
    var res = typeof(suffix) == "string"? suffix:suffix[0];
    var reg = RegExp(res);
    var reg2 = RegExp(res,"g");
}
else{
    //var res = "/(" + suffix.join(")|(") + ")/";
    var res = "/\.(" + suffix.join("|") + ")/";
    //var res = "/[" + suffix.join("]|[") + "]/";
    //res = res.replace(/\./g,'\\.');
    var reg = new RegExp(res);
    var reg2 = new RegExp(res,"g");
}
var text = "/index.html?url=http://sjsnj.com/dufaut.shtmls";
console.log(res);
console.log(text.match(reg));
console.log(text.search(reg));
console.log(text.replace(reg2,'.js'));
console.log(reg.test(text),reg.test("http://moodlove.blog.hexun.com/83567439_d.shtml"));

// 多元素比配
var reg = /(wd|baidu|utf)/g;
var text = "https://www.baidu.com/s?wd=socket.io%E6%95%99%E7%A8%8B&rsp=0&f=1&oq=socket.io&tn=monline_3_dg&ie=utf-8&rsv_pq=f92144720000f934&rsv_t=f51fkFM6izHjbG942OxJAeWFuVqrr0KlWkfCfJ264Um%2F9gy6Bt8Sv9%2BbhBEy6xNJwryd&rqlang=cn&rsv_ers=xn0&rs_src=0";
console.log(text.match(reg),reg.test(text),text.search(reg));
console.log(reg);

// - shtml/html/htm
//var reg = /(shtml|html|htm)/gi;
var suffix = ["shtml","html","htm"];// 先后顺序
var res = "\\.(" + suffix.join("|") + ")";
var reg = new RegExp(res,'gi')
var text = "/conero/finance/index.html?url=dufaut.htm&name=shtml&liek=dkddjd&che=.HTML";
console.log(text.match(reg),reg.test(text),text.search(reg));
console.log(reg);